package com.foreknow.elmboot_demo.controller;

import com.foreknow.elmboot_demo.po.User;
import com.foreknow.elmboot_demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/UserController")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/getUserByUserIdByPass")
    public User getUserByUserIdByPass(String userId, String password) throws Exception {
        return userService.getUserByUserIdByPass(userId, password);
    }

    @RequestMapping("/getUserByUserId")
    public int getUserByUserId(String userId) throws Exception {
        return userService.getUserByUserId(userId);
    }

    @RequestMapping("/saveUser")
    public int saveUser(User user) throws Exception{
        return userService.saveUser(user);
    }
}
